WIFI_RTL8188EUS_SITE_METHOD = git
WIFI_RTL8188EUS_SITE = https://github.com/aircrack-ng/rtl8188eus
WIFI_RTL8188EUS_VERSION = 6146193406b62e942d13d4d43580ed94ac70c218

WIFI_RTL8188EUS_LICENSE = GPL-2.0, proprietary (rtl8188fufw.bin firmware blob)
WIFI_RTL8188EUS_LICENSE_FILES = COPYING

WIFI_RTL8188EUS_MODULE_MAKE_OPTS = \
	KSRC=$(LINUX_DIR) \
	KVERSION=$(LINUX_VERSION_PROBED) \
	CONFIG_WLAN=y \
	CONFIG_WIRELESS=y \
	CONFIG_WIRELESS_EXT=y \
	CONFIG_WEXT_CORE=y \
	CONFIG_WEXT_PROC=y \
	CONFIG_WEXT_PRIV=y \
	CONFIG_CFG80211=y \
	CONFIG_MAC80211=y \
	CONFIG_MAC80211_RC_MINSTREL=y \
	CONFIG_MAC80211_RC_MINSTREL_HT=y \
	CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y \
	CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" \
	CONFIG_RTL8188EU=m \
	CONFIG_CALIBRATE_TX_POWER_TO_MAX=y

define WIFI_RTL8188EUS_INSTALL_FIRMWARE
	$(INSTALL) -D -m 0644 $(WIFI_RTL8188EUS_PKGDIR)/rtl8188fufw.bin \
		$(TARGET_DIR)/lib/firmware/rtlwifi/rtl8188fufw.bin
endef

define WIFI_RTL8188EUS_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WIRELESS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WIRELESS_EXT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_CORE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_PROC)
	$(call KCONFIG_ENABLE_OPT,CONFIG_WEXT_PRIV)
	$(call KCONFIG_SET_OPT,CONFIG_CFG80211,y)
	$(call KCONFIG_SET_OPT,CONFIG_MAC80211,y)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_MINSTREL)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_MINSTREL_HT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MAC80211_RC_DEFAULT_MINSTREL)
	$(call KCONFIG_SET_OPT,CONFIG_MAC80211_RC_DEFAULT,"minstrel_ht")
endef

WIFI_RTL8188EUS_POST_INSTALL_TARGET_HOOKS += WIFI_RTL8188EUS_INSTALL_FIRMWARE

$(eval $(kernel-module))
$(eval $(generic-package))
